package com.umakr.demo.controller;

import com.umakr.demo.model.Combobox;
//import com.umakr.demo.service.AService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by yangliu on 2017/8/15.
 // */
//@SuppressWarnings("ALL")
//@RequestMapping("/day13")
////@Controller
////public class Controller13 {
//    @Autowired
//    AService.TestService testService;
//
//
//    @RequestMapping("/index")
//    public String ineex(){
//        return "/day13/test01";
//    }
//
//    @RequestMapping("/dataDatagrid")
//    @ResponseBody
//    public List<Student> dataDatagrid(){
////        System.out.println(testService.testSelect());
////        System.out.println(map);
////        return map;
//        List<Student> list = testService.testSelect();
//        return list;
//    }
//
//    @RequestMapping("saveStudent")
//    @ResponseBody
//    public List<Student> saveStudent(String sname, String ssex, String sbirthday , String classes){
//        Student student = new Student(sname,ssex,sbirthday,classes);
//        testService.add(student);
//        List<Student> list = testService.testSelect();
//        return list;
//    }
//
//    @RequestMapping("updataStudent")
//    @ResponseBody
//    public List<Student> updataStudent(int sno,String sname, String ssex, String sbirthday , String classes){
//        System.out.println(sno);
//        Student student = new Student(sno,sname, ssex,  sbirthday , classes);
//        testService.updataStudent(student);
//        List<Student> list = testService.testSelect();
//        return list;
//    }
//    @RequestMapping("/removeStudent")
//    @ResponseBody
//    public List<Student> removeStudent(int sno,String sname, String ssex, String sbirthday , String classes){
//        Student student = new Student(sno,sname, ssex,  sbirthday , classes);
//        testService.delete(student);
//        List<Student> list = testService.testSelect();
//        return list;
//    }

//    Combobox 的开始

//    @Autowired
//    AService.B tsestComboboxService;
//
//    @RequestMapping("/showCombobox")
//    public String show(){
//        return "day13/combobox";
//    }
//
//    @RequestMapping("/comboboxData")
//    @ResponseBody
//    public List comboboxData(){
//        List<Combobox> list = tsestComboboxService.getAll();
//        System.out.println(list);
//        return list;
//    }
//
////  tree的开始
//
//    @Autowired
//    AService testTreeService;
//
//    @RequestMapping("/showTree")
//    public String showTree(){
//        return "day13/tree";
//    }
//
//    @RequestMapping("/treeData")
//    @ResponseBody
//    public List<Combobox.Tree> treeData() {
//        List<Combobox.Tree> root = testTreeService.findById("0");
//        return  buildTree(root);
//    }
//    public List<Combobox.Tree> buildTree(List<Combobox.Tree> root){
//        for(int i=0;i<root.size();i++){
//            List<Combobox.Tree> children = testTreeService.findByPid(root.get(i).getId()); //查询某节点的子节点（获取的是list）
//            buildTree(children); root.get(i).setChildren(children);
//       }
//        return root; }
//
//}
